﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using SARUserControls.ChangJingCanshu.DialogFrames;

namespace SARUserControls
{
	/// <summary>
	/// CanshuPage.xaml 的交互逻辑
	/// </summary>
	public partial class CanshuPage : DialogPageBase
	{
		public CanshuPage()
		{
			this.InitializeComponent();
		}


        #region DialogPageBase Members

        public string getTitle()
        {
            return "二维属性设置";
        }

        public IDictionary<string, object> getValues()
        {
            IDictionary<string, object> values = new Dictionary<string, object>();
            values.Add("hengxiangdianshu", txtHenxiangdianshu.SARContentTxt);
            values.Add("zongxiangdianshu", txtZongxiangdianshu.SARContentTxt);
            values.Add("hengxiangjianju", txtHengxiangjianju.SARContentTxt);
            values.Add("zongxiangjianju", txtZongxiangjianju.SARContentTxt);
            return values;
        }

        public IDictionary<string, object> getDefaultValues()
        {
            IDictionary<string, object> values = new Dictionary<string, object>();
            values.Add("hengxiangdianshu", 1);
            values.Add("zongxiangdianshu", 1);
            values.Add("hengxiangjianju", 0);
            values.Add("zongxiangjianju", 0);
            return values;
        }

        public void setValues(IDictionary<string, object> values)
        {
            if (values.ContainsKey("hengxiangdianshu"))
            {
                txtHenxiangdianshu.SARContentTxt = Double.Parse(values["hengxiangdianshu"].ToString());
            }
            if (values.ContainsKey("zongxiangdianshu"))
            {
                txtZongxiangdianshu.SARContentTxt = Double.Parse(values["zongxiangdianshu"].ToString());
            }
            if (values.ContainsKey("hengxiangjianju"))
            {
                txtHengxiangjianju.SARContentTxt = Double.Parse(values["hengxiangjianju"].ToString());
            }
            if (values.ContainsKey("zongxiangjianju"))
            {
                txtZongxiangjianju.SARContentTxt = Double.Parse(values["zongxiangjianju"].ToString());
            }
        }

        #endregion 
    }
}